﻿
using Archiecture.API.Application.Commands.SupplierCommand;
using Architecture.Domain.Dto.Source;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Archiecture.API.Controllers
{
    /// <summary>
    /// 供应商管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]

    public class SupplierController : ControllerBase
    {
        private readonly IMediator _mediator;

        public SupplierController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 获取供应商信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<ImgDto>> GetSupplierList([FromQuery] GetSupplierListCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 操作图片
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> OperationImg([FromQuery] OperationImgCommand command)
        {
            return await _mediator.Send(command);
        }
    }


}
